import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: localStorage.getItem('state') ? JSON.parse(localStorage.getItem('state')) :  {
    userInfo: null,
    curRouteCnt: null,
    curRouteCntLeft: null
  },
  mutations: {
    // 设置当前登录的用户
    setUserInfo(state, data) {
      state.userInfo = data;
    },
    // 设置当前的头部标签栏（网盘/分享）
    setInitContentRoute(state, data) {
      state.curRouteCnt = data;
    },
    // 设置在网盘下左侧导航栏的页签
    setCurCntLeftRoute(state, data) {
      state.curRouteCntLeft = data;
    }
  },
  actions: {
  }
})